package cn.fanqinghong.ymcc.web.controller;

import cn.fanqinghong.ymcc.result.JSONResult;
import cn.fanqinghong.ymcc.service.ITokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * FAN
 * 2022/7/27  16:35
 */
@RestController
public class TokenController {
    @Autowired
    private ITokenService tokenService;

    /**
     * 创建防重复Token
     * @param courseId
     * @return
     */
    @GetMapping("createToken/{courseId}")
    public JSONResult creatToken(@PathVariable("courseId") String courseId){
        String token = tokenService.creatToken(courseId);
        return JSONResult.success(token);
    }
}

